package edu.uclmgmu.bacteriosec.domain.testCaseRunner;

import java.util.List;

import org.junit.internal.TextListener;
import org.junit.runner.JUnitCore;
import org.junit.runner.Request;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;

public class SingleJUnitTestRunner {
    public static void main(String... args) throws ClassNotFoundException {
    	Request request;
    	if (args[0].indexOf("#")==-1) {
    		request=Request.aClass(Class.forName(args[0]));
    	} else {
    		String[] classAndMethod = args[0].split("#");
        	request = Request.method(Class.forName(classAndMethod[0]), classAndMethod[1]);
    	}
    	JUnitCore core=new JUnitCore();
    	RunListener listener= new TextListener(System.out);
    	core.addListener(listener);
    	
        Result result = core.run(request);
        System.exit(0);
    }
}